import { navData } from "@/untils/nav"
import { createRouter, createWebHashHistory } from "vue-router"

const routes = [
  { id: 0, name: 'Home', title: '首页', path: '/', component: "views/home/home.vue" },
]

navData.forEach((element) => {
  routes.push({
    id: element.id,
    name: element.name,
    title: element.title,
    path: element.path,
    component: () => import("@/" + element.component)
  })
})

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

export default router